<?php
class AnesthesiologistsController extends AppController{
	public function insert($data){
		$this->data['Anesthesiologist']['claimid']=$data[0];
		$this->data['Anesthesiologist']['firstname']=$data[1];
		$this->data['Anesthesiologist']['middlename']=$data[2];
		$this->data['Anesthesiologist']['lastname']=$data[3];
		$this->data['Anesthesiologist']['serviceperformed']=$data[5];
		$this->data['Anesthesiologist']['accreditationcode']=$data[4];
		$this->data['Anesthesiologist']['date']=date('Y-m-d',strtotime($this->toDate($data[6])));
		$this->data['Anesthesiologist']['rvs']=$data[7];
		$this->data['Anesthesiologist']['rvu']=$data[8];
		$this->data['Anesthesiologist']['pcf']=$data[9];
		$this->data['Anesthesiologist']['actualcharge']=str_replace(',', '', $data[10]);
		$this->data['Anesthesiologist']['benefitclaim']=str_replace(',', '', $data[11]);
		$this->data['Anesthesiologist']['status']=1;
		
		$this->Anesthesiologist->create();		
		$this->Anesthesiologist->save($this->data);
	}
	private function toDate($date){
		$y=substr($date,4,4);
		$m=substr($date,0,2);
		$d=substr($date,2,2);
		$date=$y.'-'.$m.'-'.$d;		
		return $date;
	}
	function setRvsRvuPcf(){
		$rvs=$_POST['rvs'];
		$rvu=$_POST['rvu'];
		$pcf=$_POST['pcf'];
		$actualcharge=(($rvu*$pcf)*$pcf)/100;
		
		$this->data['Anesthesiologist']['id']=$_POST['id'];
		$this->data['Anesthesiologist']['rvs']=$rvs;
		$this->data['Anesthesiologist']['rvu']=$rvu;
		$this->data['Anesthesiologist']['pcf']=$pcf;
		$this->data['Anesthesiologist']['actualcharge']=$actualcharge;
		
		$this->Anesthesiologist->save($this->data);
	}
	function setStatus($id, $status){
		$this->data['Anesthesiologist']['id']=$id;
		$this->data['Anesthesiologist']['status']=$status;
		
		$this->Anesthesiologist->save($this->data);
	}
}
?>